import {
	defineConfig
} from 'vite';
import {
	resolve
} from 'path';
import uni from '@dcloudio/vite-plugin-uni';
import AutoImport from "unplugin-auto-import/vite";
export default defineConfig({
	plugins: [uni(),
		AutoImport({
			include: [
				/\.[tj]sx?$/,
				/\.vue$/,
				/\.vue\?vue/,
			],
			imports: ["vue", "uni-app", "pinia"],
			dts: "auto-imports.d.js",
		}),
	],
	resolve: {
		alias: {
			'api': resolve(__dirname, './api'),
			'hooks': resolve(__dirname, './hooks'),
			'utils': resolve(__dirname, './utils'),
			'com': resolve(__dirname, './components'),
			'static': resolve(__dirname, './static'),
			'images': resolve(__dirname, './static/images'),
			'store': resolve(__dirname, './store'),
			'@': resolve(__dirname, './')
		}
	},
	server: {
		proxy: {
			'/api': {
				target: 'http://127.0.0.1:9588',
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, '')
			}
		}
	}
});